package com.lwb.edustatistics.controller;


import com.lwb.commonutils.Row;
import com.lwb.edustatistics.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-12-14
 */
@RestController
@RequestMapping("/edustatistics/statistics-daily")
@CrossOrigin
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService statisticsDailyService;

    //统计某天注册人数
    @PostMapping("registerCount/{day}")
    public Row registerCount(@PathVariable String day){

        statisticsDailyService.registerCount(day);

        return Row.SUCCESS();
    }

    //图表显示，返回两部分数据，日期json，数量json
    @GetMapping("showDate/{type}/{begin}/{end}")
    public Row showDate(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map = statisticsDailyService.showDate(type,begin,end);
        return Row.SUCCESS().data(map);

    }

}

